/**
数据库管理
 **/
package com.centon.auto_code.project.controller;

import com.centon.auto_code.project.service.DatabaseService;
import com.centon.auto_code.project.vo.ProDatabaseVo;
import com.centon.auto_code.project.vo.ProTableVo;
import com.centon.auto_code.vo.BaseRes;
import com.centon.auto_code.vo.PageData;
import java.util.List;
import javax.annotation.Resource;
import javax.annotation.Title;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("adapi/database")
public class DatabaseController {

    @Resource
    private DatabaseService databaseService;

    /**
     * @gen_378_lwl
     * 获取数据库列表
     * null
     * @param proDatabaseVo
    **/
    @Title("获取数据库列表")
    @ResponseBody
    @RequestMapping(value="entityPage", method=RequestMethod.GET)
    public BaseRes<PageData<ProDatabaseVo>> entityPage(ProDatabaseVo proDatabaseVo) {
        return databaseService.entityPage(proDatabaseVo);
    }
    /**
     * @gen_379_lwl
     * 获取数据所有表
     * null
     * @param dbId
    **/
    @Title("获取数据所有表")
    @ResponseBody
    @RequestMapping(value="tableList/{dbId}", method=RequestMethod.GET)
    public BaseRes<List<ProTableVo>> tableList(@PathVariable("dbId") String dbId) {
        return databaseService.tableList(dbId);
    }
    /**
     * @gen_397_lwl
     * 添加数据库
     * 添加数据库
     * @param proDatabaseVo
    **/
    @Title("添加数据库")
    @ResponseBody
    @RequestMapping(value="/adddatabase", method=RequestMethod.POST)
    public BaseRes<String> addDataBase(@RequestBody ProDatabaseVo proDatabaseVo, BindingResult bindingResult) {
        return databaseService.addDataBase(proDatabaseVo);
    }
    /**
     * @gen_398_lwl
     * 获取数据库详情
     * 获取数据库详情
     * @param proDatabaseVo
    **/
    @Title("获取数据库详情")
    @ResponseBody
    @RequestMapping(value="/datadetail", method=RequestMethod.POST)
    public BaseRes<ProDatabaseVo> dataBaseDetail(@RequestBody ProDatabaseVo proDatabaseVo, BindingResult bindingResult) {
        return databaseService.dataBaseDetail(proDatabaseVo);
    }
}
